@import 'common.less';

@import (inline) '../../node_modules/codemirror/lib/codemirror.css';
@import '../../node_modules/mirrorsharp/mirrorsharp.less';
@import '../../node_modules/mirrorsharp-codemirror-6-preview/mirrorsharp.less';
@import (inline) 'codemirror/addon-jump-arrows.css';

textarea, .CodeMirror {
    .code-text();
    position: absolute;
    height: auto;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
}

/* TODO: move to mirrorsharp */
.CodeMirror-hint {
    padding-top: 2px;
    padding-bottom: 2px;
}

.mirrorsharp-any-tooltip,
.mirrorsharp-tip-content {
    line-height: 1.3;
}

.CodeMirror-lintfix-fix {
    padding-top: 2px;
    padding-bottom: 2px;
}
/* END TODO */

.CodeMirror-linenumber {
    padding-left: 0;
}

.CodeMirror-lintfix-popup-marker, .CodeMirror-lintfix-popup {
    box-sizing: content-box;
    -moz-box-sizing: content-box;
}

.mirrorsharp-theme {
    .cm-keyword, .cm-atom {
        color: #708; /* does not match VS, but plays better with the TR color scheme */
    }

    .cm-tag {
        color: #bbb;
    }
}

.highlighted {
    background-color: var(--highlight-color);
}

.CodeMirror-widget[cm-ignore-events=true] {
    pointer-events: none;
}

.flow-line-end {
    display: inline-block;
    padding: 0px 5px;
    margin-left: 5px;
    font-size: 90%;
    pointer-events: none;
}

.flow-line-end-notes {
    background: #eee;
}

.flow-line-end-exception {
    background: @error-color;
    color: #fff;

    .root-status-offline & {
        background: var(--offline-header-color);
        color: #fff !important;
    }
}

/* CodeMirror 6 Preview */

.cm6-preview {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;

    .disclaimer {
        margin: 4px;
        width: calc(100% - 8px);
    }

    .mirrorsharp {
        flex-grow: 1;
        display: flex;
        .code-text();
    }

    .cm-wrap {
        width: 100%;
    }

    .theme-dark & .mirrorsharp {
        // TODO: Not supported yet
        background-color: #fff;
        color: #000;
    }
}